package com.yunji.base.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.yunji.base.domain.ShortCutMenuDO;
import com.yunji.base.vo.ShortCutVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.user.mapper
 * @Title: ShortCutMapper
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * <p>
 * 2024-09-05 09:47:57      V1.0        HuaAo       新建类
 */

public interface IShortCutMapper extends MPJBaseMapper<ShortCutMenuDO> {

    @Select({"<script>select sm.*,s.menu_name AS menu_name,p.icon AS menu_icon,concat(p.path,'/',s.path) AS menu_path from v3_shortcut_menu sm, sys_menu s,sys_menu p",
            " where sm.menu_id=s.menu_id and p.menu_id=s.parent_id and sm.del_flag=0 and s.menu_type = 'C'",
            "<if test='userId != null'> and sm.user_id =#{userId}</if>",
            "<if test='status != null'> and sm.status =#{status}</if></script>"})
    List<ShortCutVO> listByUserId(@Param("userId") Long userId, @Param("status") Integer status);
}